﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Service" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<link href="#{path.css}ybb/css/prettyPhoto.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript" language="JavaScript">
    var mangerlist_filecheck_js_filedirok = "_{mangerlist_filecheck_js_filedirok}";
    var mangerlist_filecheck_js_filedirno = "_{mangerlist_filecheck_js_filedirno}";
    var iframename = "#{iframename}";
    var checkfrom = "#{checkfrom}";
    var getbyid = "#{getbyid}";
    var editiframename = "#{iframeid}";
    var fileinputid = "#{fileinputid}";
    var digheight = "#{digheight}";
    var rootDIR = "#{rootDIR}";
    var picview = "#{picview}&fheight=#{framt}";
    var fileview = "#{fileview}&fheight=#{framt}";
	$(document).ready(function(){
		var h = parseInt(digheight);
		var w = $(window).width();
		$('#mainwindowstr').css({height:h-45,width: w-12});
		$('.upfilewindow').css({height:h-45});
	})

	function resetwindow(){
		parent.closeifram();
	}

	function fnUpdate(){
		$("#floatBoxBg").hide();
		$("#floatBox").hide();
	}

	function refile(filename,iswidth){
		if (checkfrom=='edit'){
			checkimageinput(filename,fileinputid);
		}else if(checkfrom=='input'){
			checkinput(filename,fileinputid);
		}else if(checkfrom=='function'){
			functionpic(filename,fileinputid,getbyid,iswidth);
		}else if(checkfrom=='picshow'){
			picshow(filename,fileinputid,getbyid,iswidth);
		}else if(checkfrom=='editwin'){
			checkimageeditor(filename,fileinputid);
		}
	}

	function checkimageeditor(filename,inputnameID){

		var win = parent.frames[iframename].frames[editiframename];







		filename=rootDIR+filename;
		win.document.getElementById(inputnameID).value = filename;


		if (typeof(win.ImageDialog) != "undefined") {
			if (win.ImageDialog.getImageData) win.ImageDialog.getImageData();
			if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(filename);
		}
		parent.closeifram();
	}

	function checkimageinput(filename,inputnameID){


		if ($.browser.msie){
			var win = parent.frames[iframename].frames[editiframename];
		}else{
			var win = parent.frames[iframename].frames[1];
		}

		var filenames = filename.split('|');
		var src_tex='';
		for (var i = 0; i < filenames.length; i++){
			src_tex+='<img src="'+rootDIR+filenames[i]+'" alt="" />';
		}
		parent.frames[iframename].tinyMCE.execCommand('mceInsertContent',false,src_tex);



		parent.closeifram();
		/**
		win.document.getElementById(inputnameID).value = filename;

		if (typeof(win.ImageDialog) != "undefined") {
			if (win.ImageDialog.getImageData) win.ImageDialog.getImageData();
			if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(filename);
		}
		**/
		parent.closeifram();
	}

	function checkinput(filename,inputnameID){
		parent.frames[iframename].document.getElementById(inputnameID).value = filename;
		parent.closeifram();
	}

	function picshow(filename,inputnameID,getbyid,iswidth){
	    parent.frames[iframename].document.getElementById(inputnameID).value = filename;
		parent.frames[iframename].addpicshow(filename,getbyid,iswidth,inputnameID,fileinputid);
		parent.closeifram();
	}

	function functionpic(filename,inputnameID,getbyid,iswidth){
		parent.frames[iframename].addpicipnput(filename,inputnameID,getbyid,iswidth,iframename);
		parent.closeifram();
	}

	function selectfile(){
		var filename=$('.pp_description').html();
		var fileinputid = "#{fileinputid}";
		if (checkfrom=='edit'){
			checkimageinput(filename);
		}else if(checkfrom=='input'){
			checkinput(filename,fileinputid);
		}else if(checkfrom=='function'){
			functionpic(filename,fileinputid);
		}
	}
	function flushiframe(getid){
		var url = (getid=='piclist') ? picview : fileview;
		document.getElementById(getid).src = url;
	}
	document.oncontextmenu=new Function('event.returnValue=false;');
	document.onselectstart=new Function('event.returnValue=false;');
</script>
</head>

<body style="background-color: #FFFFFF">
<div class="centerrightwindow"  style="background-color: #FFFFFF">
	<div id="mainwindowtab">
        <%var filetype = v.data("filetype").ToString(); %>
        <%if(filetype =="img"){ %>
		<ul>
			<li class="hover" id="tabbottonul1" href="#body" onmousedown="javascript:windowsclass('#tabbottonul1','#tabcontentdiv1','tabbottonul','tabcontentdiv',1,4,'hover','hover2');">上传文件</li>
			<li id="tabbottonul2" href="#body" onmousedown="javascript:windowsclass('#tabbottonul2','#tabcontentdiv2','tabbottonul','tabcontentdiv',2,4,'hover','hover2');">批量上传</li>
			<li id="tabbottonul3" href="#body" onmousedown="javascript:windowsclass('#tabbottonul3','#tabcontentdiv3','tabbottonul','tabcontentdiv',3,4,'hover','hover2');flushiframe('piclist');">相册浏览模式</li>
			<li id="tabbottonul4" href="#body" onmousedown="javascript:windowsclass('#tabbottonul4','#tabcontentdiv4','tabbottonul','tabcontentdiv',4,4,'hover','hover2');flushiframe('filelist');">文件夹浏览模式</li>
		</ul>
		<%}else{ %>
		<ul>
			<li class="hover" id="tabbottonul1" href="#body" onmousedown="javascript:windowsclass('#tabbottonul1','#tabcontentdiv1','tabbottonul','tabcontentdiv',1,3,'hover','hover2');">上传文件</li>
			<li id="tabbottonul2" href="#body" onmousedown="javascript:windowsclass('#tabbottonul2','#tabcontentdiv2','tabbottonul','tabcontentdiv',2,3,'hover','hover2');">批量上传</li>
			<li id="tabbottonul3" href="#body" onmousedown="javascript:windowsclass('#tabbottonul3','#tabcontentdiv4','tabbottonul','tabcontentdiv',3,3,'hover','hover2');flushiframe('filelist');">文件夹浏览模式</li>
		</ul>
		<%} %>
	</div>
	<div id="mainwindowstr">
		<div id="tabcontentdiv1" class="displaytrue"><iframe name="upfilewindow" class="upfilewindow" src="#{loadurl}&fheight=#{framt}" width="100%" height="#{framt}" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>
		<div id="tabcontentdiv2" class="displaynone"><iframe name="upbatfilewindow" class="upfilewindow" src="#{batupwindow}&fheight=#{framt}" width="100%" height="#{framt}" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>
		<div id="tabcontentdiv3" class="displaynone"><iframe name="piclist" id="piclist" class="upfilewindow" src="#" width="100%" height="#{framt}" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>
		<div id="tabcontentdiv4" class="displaynone"><iframe name="filelist" id="filelist" class="upfilewindow" src="#" width="100%" height="#{framt}" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>
	</div>
</div>
</body>

</html>
